#ifndef QDRIVEATTRIBUTE_H
#define QDRIVEATTRIBUTE_H

#include "shared_global.h"

#include <QObject>
#include <QMap>
#include <QIcon>
#include <QVariant>

#include <QXmlStreamWriter>
#include <QXmlStreamReader>

class SHAREDSHARED_EXPORT QDriveAttribute : public QObject
{
    Q_OBJECT
public:
    explicit QDriveAttribute(const QString &name,const QString &info=QString(),QObject *parent = 0);

    QVariant attribute(const QString &key,const QVariant &def=QVariant());
    void    setAttribute(const QString &key,const QVariant &value);

    QString name();
    QString information();
    virtual QString valueText();
    virtual QIcon   valueIcon();

    virtual void setValue(const QVariant &value);
    virtual QVariant value();

    virtual void    read(QXmlStreamReader &r);
    virtual void    write (QXmlStreamWriter &w);

signals:
    void    valueChanged();
public slots:

protected:
    QString     m_name;
    QString     m_information;
    QVariant     m_value;
    QMap<QString,QVariant>   m_attribute;
};

class SHAREDSHARED_EXPORT QDriveStringAttribute : public QDriveAttribute
{
    Q_OBJECT
public:
    QDriveStringAttribute(const QString &name,const QString &info=QString(),QObject *parent = 0);
};

class SHAREDSHARED_EXPORT QDriveNumberAttribute: public QDriveAttribute
{
    Q_OBJECT
public:
    QDriveNumberAttribute(const QString &name,const QString &info=QString(),QObject *parent = 0);
};

class SHAREDSHARED_EXPORT QDriveEnumAttribute: public QDriveAttribute
{
    Q_OBJECT
public:
    QDriveEnumAttribute(const QString &name,const QString &info=QString(),QObject *parent = 0);
};

#endif // QDRIVEATTRIBUTE_H
